from locust import HttpLocust,task,TaskSet
class test_01(TaskSet):
    @task(1)
    def test_001(self):
        data={'username':'admin','password':'admin','verifycode':'0000'}
        res=self.client.post('/WoniuSales/user/login',data,catch_response=True)
        if res.text=='login-pass':
            res.success()
        else:
            res.failure('login-ko--test001')

    @task(2)
    def test_002(self):
        data = {'username': 'admin', 'password': 'admin123', 'verifycode': '0000'}
        res = self.client.post('/WoniuSales/user/login', data, catch_response=True)
        if res.text == 'login-pass':
            res.success()
        else:
            res.failure('login-ko---test002')



class test_02(HttpLocust):
    task_set = test_01
    min_wait = 1000
    max_wait = 2000